package com.yami.shop.im.service;

import com.yami.shop.im.bean.ImRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.im.bo.ShopSessionInfo;
import com.yami.shop.im.bo.SysSessionInfo;
import com.yami.shop.im.bo.UserSessionInfo;
import com.yami.shop.im.param.SysUserParam;
import com.yami.shop.im.vo.Conversation;
import com.yami.shop.im.vo.MsgItem;

import java.io.IOException;
import java.util.List;

public interface ImRecordService extends IService<ImRecord>{


    /**
     * 获取两者之间的聊天记录
     * @param shopId 店铺id
     * @param userId 用户id
     * @param size 获取多少条
     * @param sendType
     */
    List<ImRecord> listHistory(Long shopId, String userId, Integer size, Integer sendType);


    /**
     * 列出最后的对话信息列表
     * @param userId
     * @param maxDay
     * @return
     */
    List<Conversation> listConversationByUserId(String userId, Integer maxDay);

    /**
     * 列出最后的对话信息列表
     * @param shopId
     * @param maxDay
     * @param sendType
     * @return
     */
    List<Conversation> listConversationByShopId(Long shopId, Integer maxDay, int sendType);

    /**
     * 将聊天记录变成已读状态
     * @param userId
     * @param shopId
     * @param source
     * @param sendType
     */
    void updateToRead(String userId, Long shopId, int source, int sendType);

    MsgItem getMsgItem(ShopSessionInfo shopSessionInfo, UserSessionInfo userSessionInfo, ImRecord record);

    MsgItem getMsgItemByPlatform(SysSessionInfo sysSessionInfo, UserSessionInfo userSessionInfo, ImRecord record);


    void receiveMsg(Long id, Long userId)  throws IOException;

    SysUserParam getLatelyUser(int maxDay, String userId);

    void forwardMsg(SysUserParam param) throws IOException;
}
